Optimal. Leaf size=129 \[ \frac{a b \left (13 a^2-8 b^2\right ) \sin (c+d x)}{6 d}+\frac{b^2 \left (14 a^2-9 b^2\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac{1}{8} x \left (8 a^4-3 b^4\right )-\frac{b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}+\frac{a b \sin (c+d x) (a+b \cos (c+d x))^2}{12 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.201382, antiderivative size = 129, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 30, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.1, Rules used = {3016, 2753, 2734} \[ \frac{a b \left (13 a^2-8 b^2\right ) \sin (c+d x)}{6 d}+\frac{b^2 \left (14 a^2-9 b^2\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac{1}{8} x \left (8 a^4-3 b^4\right )-\frac{b \sin (c+d x) (a+b \cos (c+d x))^3}{4 d}+\frac{a b \sin (c+d x) (a+b \cos (c+d x))^2}{12 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3016
Rule 2753
Rule 2734
Rubi steps
\begin{align*} \int (a+b \cos (c+d x))^2 \left (a^2-b^2 \cos ^2(c+d x)\right ) \, dx &=-\int (-a+b \cos (c+d x)) (a+b \cos (c+d x))^3 \, dx\\ &=-\frac{b (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}-\frac{1}{4} \int (a+b \cos (c+d x))^2 \left (-4 a^2+3 b^2-a b \cos (c+d x)\right ) \, dx\\ &=\frac{a b (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}-\frac{b (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}-\frac{1}{12} \int (a+b \cos (c+d x)) \left (-a \left (12 a^2-7 b^2\right )-b \left (14 a^2-9 b^2\right ) \cos (c+d x)\right ) \, dx\\ &=\frac{1}{8} \left (8 a^4-3 b^4\right ) x+\frac{a b \left (13 a^2-8 b^2\right ) \sin (c+d x)}{6 d}+\frac{b^2 \left (14 a^2-9 b^2\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac{a b (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}-\frac{b (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}\\ \end{align*}
Mathematica [A] time = 0.219931, size = 89, normalized size = 0.69 \[ -\frac{-48 a b \left (4 a^2-3 b^2\right ) \sin (c+d x)-96 a^4 d x+16 a b^3 \sin (3 (c+d x))+24 b^4 \sin (2 (c+d x))+3 b^4 \sin (4 (c+d x))+36 b^4 c+36 b^4 d x}{96 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.021, size = 87, normalized size = 0.7 \begin{align*}{\frac{1}{d} \left ( -{b}^{4} \left ({\frac{\sin \left ( dx+c \right ) }{4} \left ( \left ( \cos \left ( dx+c \right ) \right ) ^{3}+{\frac{3\,\cos \left ( dx+c \right ) }{2}} \right ) }+{\frac{3\,dx}{8}}+{\frac{3\,c}{8}} \right ) -{\frac{2\,a{b}^{3} \left ( 2+ \left ( \cos \left ( dx+c \right ) \right ) ^{2} \right ) \sin \left ( dx+c \right ) }{3}}+2\,{a}^{3}b\sin \left ( dx+c \right ) +{a}^{4} \left ( dx+c \right ) \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 0.997582, size = 113, normalized size = 0.88 \begin{align*} \frac{96 \,{\left (d x + c\right )} a^{4} + 64 \,{\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a b^{3} - 3 \,{\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} b^{4} + 192 \, a^{3} b \sin \left (d x + c\right )}{96 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.40704, size = 188, normalized size = 1.46 \begin{align*} \frac{3 \,{\left (8 \, a^{4} - 3 \, b^{4}\right )} d x -{\left (6 \, b^{4} \cos \left (d x + c\right )^{3} + 16 \, a b^{3} \cos \left (d x + c\right )^{2} + 9 \, b^{4} \cos \left (d x + c\right ) - 48 \, a^{3} b + 32 \, a b^{3}\right )} \sin \left (d x + c\right )}{24 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 1.32987, size = 190, normalized size = 1.47 \begin{align*} \begin{cases} a^{4} x + \frac{2 a^{3} b \sin{\left (c + d x \right )}}{d} - \frac{4 a b^{3} \sin ^{3}{\left (c + d x \right )}}{3 d} - \frac{2 a b^{3} \sin{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} - \frac{3 b^{4} x \sin ^{4}{\left (c + d x \right )}}{8} - \frac{3 b^{4} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} - \frac{3 b^{4} x \cos ^{4}{\left (c + d x \right )}}{8} - \frac{3 b^{4} \sin ^{3}{\left (c + d x \right )} \cos{\left (c + d x \right )}}{8 d} - \frac{5 b^{4} \sin{\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text{for}\: d \neq 0 \\x \left (a + b \cos{\left (c \right )}\right )^{2} \left (a^{2} - b^{2} \cos ^{2}{\left (c \right )}\right ) & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.53148, size = 123, normalized size = 0.95 \begin{align*} -\frac{b^{4} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} - \frac{a b^{3} \sin \left (3 \, d x + 3 \, c\right )}{6 \, d} - \frac{b^{4} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac{1}{8} \,{\left (8 \, a^{4} - 3 \, b^{4}\right )} x + \frac{{\left (4 \, a^{3} b - 3 \, a b^{3}\right )} \sin \left (d x + c\right )}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]